CC=arm-apple-darwin-gcc
LD=$(CC)
CFLAGS=-D__DARWIN_UNIX03 -Wall -Wstrict-selector-match -Wundeclared-selector
LDFLAGS=-ObjC -lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit \
          -framework CoreFoundation \
          -framework Foundation \
          -framework UIKit \
          -framework LayerKit \
          -framework CoreGraphics \
          -framework GraphicsServices \
          -framework CoreSurface \
          -framework CoreAudio \
          -lsqlite3
BLDDIR=../build
SRC=$(wildcard *.m)
OBJS=$(SRC:%.m=$(BLDDIR)/%.o)

all: ShoppingList SendExe

ShoppingList:  $(OBJS)
	$(LD) $(LDFLAGS) -o $(BLDDIR)/$@ $^

SendExe:
	scp ../build/ShoppingList root@192.168.0.104:/Applications/ShoppingList.app

$(BLDDIR)/%.o:    %.m %.h
	if [ ! -d $(BLDDIR) ]; then mkdir $(BLDDIR); fi
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

$(BLDDIR)/%.o:    %.m
	if [ ! -d $(BLDDIR) ]; then mkdir $(BLDDIR); fi
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean:
	rm -f *.o ShoppingList $(BLDDIR)/*
